﻿using Model;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace IService
{
    public interface INumberingRuleService
    {
        #region 基础查询方法
        Task<List<NumberingRule>> GetAllNumberingRulesAsync();
        Task<NumberingRule> GetNumberingRuleByIdAsync(long id);
        // 移除：按目标表单查询（不再使用）
        // Task<NumberingRule> GetNumberingRuleByTargetFormAsync(string targetForm);
        Task<List<NumberingRule>> GetNumberingRulesByIdsAsync(List<long> ids);
        Task<bool> NumberingRuleExistsAsync(long id);
        #endregion

        #region 数据操作方法
        Task AddNumberingRuleAsync(NumberingRule rule);
        Task UpdateNumberingRuleAsync(NumberingRule rule);
        Task DeleteNumberingRuleAsync(long id);
        #endregion

        #region 编号生成与预览方法

        Task<string> GenerateNumberByRuleIdAsync(long ruleId);
        Task<string> GenerateAndUpdateNumberAsync(long ruleId);

        Task UpdateMaxValueAfterSuccessAsync(long ruleId, int currentSerial);

        #endregion

        #region 规则重置与条件查询方法
        Task ResetNumberingRuleAsync(long ruleId);
        Task ResetAllExpiredRulesAsync();
        Task<List<NumberingRule>> QueryNumberingRulesAsync(
            long? ruleId, string prefix, DateTime? startTime, DateTime? endTime, string timeRule);
        #endregion
    }
}